import {
	getProject,
	getProjectList,
	addProject,
	deleteProjectList,
	deleteProject,
	stateProjectList,
	getProjectBody,
	updateProject,
	projectFirstDraft,
	projectEnd,
	projectFail,
	projectRewrite,
	projectUploadAlready,
	projectUploadChunk,
	projectUploadMerge,
	deleteProjectFile,
	deleteProjectImage
} from '@/api'

const state = {}

const mutations = {}

const actions = {
	// 日历查询项目数据
	async getProject({commit}, query){
		const res = await getProject(query)
		return res
	},
	// 分页查询项目列表
	async getProjectList({commit}, query){
		const res = await getProjectList(query)
		return res
	},
	// 添加项目
	async addProject({commit}, body){
		const res = await addProject(body)
		return res
	},
	// 批量删除项目
	async deleteProjectList({commit}, body){
		const res = await deleteProjectList(body)
		return res
	},
	// 删除项目
	async deleteProject({commit}, body){
		const res = await deleteProject(body)
		return res
	},
	// 状态进度查询项目列表
	async stateProjectList({commit}, query){
		const res = await stateProjectList(query)
		return res
	},
	// 查询项目详情
	async getProjectBody({commit}, query){
		const res = await getProjectBody(query)
		return res
	},
	// 编辑项目详情
	async updateProject({commit}, body){
		const res = await updateProject(body)
		return res
	},
	// 初稿提交
	async projectFirstDraft({commit}, body){
		const res = await projectFirstDraft(body)
		return res
	},
	// 项目完结
	async projectEnd({commit}, body){
		const res = await projectEnd(body)
		return res
	},
	// 项目流单
	async projectFail({commit}, body){
		const res = await projectFail(body)
		return res
	},
	// 改稿延长
	async projectRewrite({commit}, body){
		const res = await projectRewrite(body)
		return res
	},
	// 获取上传过的切片信息
	async projectUploadAlready({commit}, query){
		const res = await projectUploadAlready(query)
		return res
	},
	// 断点续传
	async projectUploadChunk({commit}, query){
		const res = await projectUploadChunk(query)
		return res
	},
	// 合并切片
	async projectUploadMerge({commit}, query){
		const res = await projectUploadMerge(query)
		return res
	},
	// 合并切片
	async deleteProjectFile({commit}, body){
		const res = await deleteProjectFile(body)
		return res
	},
	// 删除项目照片
	async deleteProjectImage({commit}, body){
		const res = await deleteProjectImage(body)
		return res
	}
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}